package com.training.java.core.homework07.collections.sets;

import java.util.HashSet;
import java.util.Set;

public class LaptopDemo {

	public static void main(String[] args) {

		/*
		 * This program builds a HashSet of Laptop objects, but with default
		 * equals() method not overridden
		 */

		// Create Laptop objects with a few duplicates.
		Laptop presario = new Laptop("HP", "Presario", 4, 100);
		Laptop pavilion = new Laptop("HP", "Pavilion", 6, 200);
		Laptop presario2 = new Laptop("HP", "Presario", 6, 200);
		Laptop lenovo = new Laptop("IBM", "Lenovo", 4, 200);

		Set<Laptop> laptops = new HashSet<>(); // Create Treeset to hold Laptop
												// objects

		// Add Laptop objects to TreeSet laptops.
		laptops.add(presario);
		laptops.add(pavilion);
		laptops.add(presario2);
		laptops.add(lenovo);

		System.out.println("Printing laptops:");
		System.out.println("=================");
		for (Laptop laptop : laptops) {
			System.out.println("Manufacturer = " + laptop.getManufacturer());
			System.out.println("Model = " + laptop.getModel());
			System.out.println("Memory = " + laptop.getMemory());
			System.out.println("Disk Capacity = " + laptop.getDiskCapacity());
			System.out.println("---------------------------------------");
		}
	}
}
